import React, { Component } from "react";
import { connect } from "dva";
import styles from "./index.less";
import ListCard from "./ListCard";
import introduce from "../../../assets/introduce.png";
import handbook from "../../../assets/handbook.png";
import standard from "../../../assets/standard.png";

@connect(stores => ({
  messageData: stores.document
}))
class DocumentCard extends Component {
  state = {
    loading: false
  };

  downLoad = url => {
    this.props.downLoad(url);
  };

  render() {
    const {
      title = "",
      describe = "",
      //  rightTxt = "",
      rightHref = []
    } = this.props;
    return (
      <div className={styles.root}>
        <span className={styles.title}>{title}</span>
        <div className={styles.describe}>
          <span>{describe}</span>
        </div>
        <ListCard
          picdata={introduce}
          leftTxt="产品简介"
          leftTxtDes="产品的介绍文档" // 产品的接入流程、服务协议
          rightTxt={
            rightHref[0] ? (
              <a
                // href={'/chanPinJianJie.pptx'}
                // download={`${rightHref[0]}`}
                // onClick={() => this.downLoad(rightHref[0])}
                style={{ padding: "13px 0" }}
              >
                点击下载
              </a>
            ) : (
              <span style={{ color: "rgba(0, 0, 0, 0.45)", padding: "13px 0" }}>
                待发布
              </span>
            )
          }
        />
        <ListCard
          picdata={handbook}
          leftTxt="用户操作手册"
          leftTxtDes="控制台的操作功能介绍"
          rightTxt={
            rightHref[1] ? (
              <a
                // onClick={() => this.downLoad(rightHref[1])}
                // href={'/yongHuCaoZuoShouCe.docx'}
                // download={`${rightHref[1]}`}
                style={{ padding: "13px 0" }}
              >
                点击下载
              </a>
            ) : (
              <span style={{ color: "rgba(0, 0, 0, 0.45)", padding: "13px 0" }}>
                待发布
              </span>
            )
          }
        />
        <ListCard
          picdata={standard}
          leftTxt="接入规范"
          leftTxtDes="API文档与接口定义"
          rightTxt={
            rightHref[2] ? (
              <a
                // onClick={() => this.downLoad(rightHref[2])}
                // href={'/jieRuGuiFan.docx'}
                // download={`${rightHref[2]}`}
                style={{ padding: "13px 0" }}
              >
                点击下载
              </a>
            ) : (
              <span style={{ color: "rgba(0, 0, 0, 0.45)", padding: "13px 0" }}>
                待发布
              </span>
            )
          }
        />
      </div>
    );
  }
}

export default DocumentCard;
